package entities;

import java.awt.Image;

/**
 * Gas Class
 * @author mateusz
 */
public class Gas extends Supply{
    private Image flamesImg, imgCopy;
    
    /**
     * Creates gas
     * @param t         associated tile
     * @param img       image
     * @param flamesImg image during explosion
     * @param myName    name of entity
     */
    public Gas(Tile t, Image img, Image flamesImg, String myName){
        super( t, img, myName);
        type = Supplies.GAS;
        updateProperties(); 
        this.imgCopy= img;
        this.flamesImg = flamesImg;
    }
    
    /**
     * Causes explosion
     */
    public void explose(){
        
        this.units = (int) (this.units * 0.8 + 1);
        this.img = flamesImg;
        updateProperties();
    }
    
    /**
     * Quench fire after explosion
     */
    public void quench(){
        this.img = imgCopy;
        updateProperties();
    }
    
}
